package StringBuilder;

import java.util.Scanner;

/**
 * ClassName:StringBuilderText004
 * Package:StringBuilder
 * Description:
 *
 * @Author:ZhangXin
 * @Create2023/1/16-18:27
 * @Version:v1.0
 */
public class StringBuilderText004 {
    public static void main(String[] args) {
        /*
         * 键盘接受一个字符串,程序判断出该字符串是否是对称字符串,并在控制台打印是或不是
         * 对称字符串:123321,111
         * 非对称字符串:123123*/

        //1.字符串的拼接
        //2.字符串的反转


        Scanner sc = new Scanner(System.in);
        System.out.println("请输入一个字符串");
        String str = sc.next();
        //反转键盘录入的字符串
//        StringBuilder sb =new StringBuilder();
//        sb.append(str);
//        sb.reverse();
//        System.out.println(sb);
        String result = new StringBuilder().append(str).reverse().toString();
        if(str.equals(result)){
            System.out.println("当前字符串是对称字符串");
        }else {
            System.out.println("当前字符串不是对称字符串");
        }
    }
}
